import 'package:hotpot/generated/json/base/json_convert_content.dart';
import 'package:hotpot/models/floor.dart';

Floor $FloorFromJson(Map<String, dynamic> json) {
	final Floor floor = Floor();
	final int? id = jsonConvert.convert<int>(json['id']);
	if (id != null) {
		floor.id = id;
	}
	final String? name = jsonConvert.convert<String>(json['name']);
	if (name != null) {
		floor.name = name;
	}
	final String? backgroundColor = jsonConvert.convert<String>(json['background_color']);
	if (backgroundColor != null) {
		floor.backgroundColor = backgroundColor;
	}
	final List<int>? tableIds = jsonConvert.convertListNotNull<int>(json['table_ids']);
	if (tableIds != null) {
		floor.tableIds = tableIds;
	}
	final int? sequence = jsonConvert.convert<int>(json['sequence']);
	if (sequence != null) {
		floor.sequence = sequence;
	}
	final List<FloorTables>? tables = jsonConvert.convertListNotNull<FloorTables>(json['tables']);
	if (tables != null) {
		floor.tables = tables;
	}
	return floor;
}

Map<String, dynamic> $FloorToJson(Floor entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['background_color'] = entity.backgroundColor;
	data['table_ids'] =  entity.tableIds;
	data['sequence'] = entity.sequence;
	data['tables'] =  entity.tables?.map((v) => v.toJson()).toList();
	return data;
}

FloorTables $FloorTablesFromJson(Map<String, dynamic> json) {
	final FloorTables floorTables = FloorTables();
	final int? id = jsonConvert.convert<int>(json['id']);
	if (id != null) {
		floorTables.id = id;
	}
	final String? name = jsonConvert.convert<String>(json['name']);
	if (name != null) {
		floorTables.name = name;
	}
	final double? width = jsonConvert.convert<double>(json['width']);
	if (width != null) {
		floorTables.width = width;
	}
	final double? height = jsonConvert.convert<double>(json['height']);
	if (height != null) {
		floorTables.height = height;
	}
	final double? positionH = jsonConvert.convert<double>(json['position_h']);
	if (positionH != null) {
		floorTables.positionH = positionH;
	}
	final double? positionV = jsonConvert.convert<double>(json['position_v']);
	if (positionV != null) {
		floorTables.positionV = positionV;
	}
	final String? shape = jsonConvert.convert<String>(json['shape']);
	if (shape != null) {
		floorTables.shape = shape;
	}
	final List<String>? floorId = jsonConvert.convertListNotNull<String>(json['floor_id']);
	if (floorId != null) {
		floorTables.floorId = floorId;
	}
	final String? color = jsonConvert.convert<String>(json['color']);
	if (color != null) {
		floorTables.color = color;
	}
	final int? seats = jsonConvert.convert<int>(json['seats']);
	if (seats != null) {
		floorTables.seats = seats;
	}
	final bool? active = jsonConvert.convert<bool>(json['active']);
	if (active != null) {
		floorTables.active = active;
	}
	return floorTables;
}

Map<String, dynamic> $FloorTablesToJson(FloorTables entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['width'] = entity.width;
	data['height'] = entity.height;
	data['position_h'] = entity.positionH;
	data['position_v'] = entity.positionV;
	data['shape'] = entity.shape;
	data['floor_id'] =  entity.floorId;
	data['color'] = entity.color;
	data['seats'] = entity.seats;
	data['active'] = entity.active;
	return data;
}